package com.ipbd.controller;

import com.ipbd.domain.UserInfo;
import com.ipbd.service.UserInfoService;
import com.ipbd.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/userInfo")
@Slf4j
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;

    /**
     * 添加用户基本信息
     * @param userInfo
     * @return
     */
    @PostMapping("/saveInfo")
    public R saveUserInfo(@RequestBody UserInfo userInfo) {
        return userInfoService.saveUserInfo(userInfo);
    }

    /**
     * 修改用户基本信息
     * @param userInfo
     * @return
     */
    @PutMapping("/updateInfo")
    public R updateUserInfo(@RequestBody UserInfo userInfo) {
        return userInfoService.updateUserInfo(userInfo);
    }

    /**
     * 回显用户基本信息
     * @return
     */
    @GetMapping("/selectInfo")
    public R selectUserInfo() {
        return userInfoService.selectUserInfo();
    }
}
